import axiso from "axios";

let baseUrl = "http://localhost:4000/api/";

let apiUrl = {
    getUserInfo : "getUserInfo",
    loadZmtArticleList : "loadZmtArticleList"
};

async function api(url,callBack) {
    let promise = axiso.get(url);
    if(callBack){
        promise.then((resp) => callBack.success(resp),callBack.error);
    }
}

async function getUserInfo(callBack) {
    api(baseUrl + apiUrl.getUserInfo,callBack)
}

async function loadZmtArticleList() {
    api(baseUrl + apiUrl.loadZmtArticleList)
}

export default {
    getUserInfo : getUserInfo,
    loadZmtArticleList : loadZmtArticleList
}